package com.huike.web.controller.business;

import com.huike.business.domain.TbBusiness;
import com.huike.business.domain.TbBusinessDto;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.service.ITbBusinessService;
import com.huike.common.annotation.Log;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.enums.BusinessType;
import com.huike.common.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/business/record")
public class BusinessRecordController extends BaseController {

    @Autowired
    private ITbBusinessService tbBusinessService;


    @Log(title = "商机", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult saveComversation_record(@RequestBody TbBusinessDto tbBusinessDto){
        TbBusinessTrackRecord tbBusinessTrackRecord = new TbBusinessTrackRecord();
        BeanUtils.copyProperties(tbBusinessDto,tbBusinessTrackRecord);
        tbBusinessService.save(tbBusinessTrackRecord);
        TbBusiness tbBusiness = new TbBusiness();
        BeanUtils.copyProperties(tbBusinessDto,tbBusiness);
        tbBusinessService.insertTbBusiness(tbBusiness);
     return AjaxResult.success();
    }

}
